import request from '@/utils/request'

// 获取部门列表
export function getDepartmentList() {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

// 添加部门
export function addDepartment(data) {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

// 根据 id 获取部门信息
/**
 * @description: 获取部门详情
 * @param {*} id 表示当前要编辑项的id值
 * @return {*}
 */
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 编辑部门详情
export function updateDepartDetail(data) {
  return request({
    method: 'put',
    url: `/company/department/${data.id}`,
    data
  })
}
// 删除部门
export function deleteDepart(id) {
  return request({
    method: 'delete',
    url: `/company/department/${id}`
  })
}
